import { DatePicker, Divider, Form, Progress, Table, Typography, type TableColumnsType } from "@/components/base"
import { Controller, MonthEnum } from "@/controller";
import React from "react";
import dayjs from "dayjs";
import { decorator } from "@/tools/fns/decorator";
import { observer } from "mobx-react";
import * as XLSX from 'xlsx';
import { toCurrencyNum } from "@/tools/fns/toCurrency";
import { countCardSwipe } from "@/tools/fns";
import styles from './index.module.less';

const { Text } = Typography;

/** 达成进度 */
const ProgressAchieved = decorator(observer)(function () {

    const [form] = Form.useForm();
    const controller = React.useContext(Controller.Context);
    const { data } = controller;
    const [values, setValues] = React.useState<any>({});

    const J1 = React.useMemo(() => {
        const date: dayjs.Dayjs = values.date; if (!date) return undefined;
        const s = date.subtract(1, 'month').date(26).startOf('day');
        const e = date.date(2).startOf('day');
        return [s, e];
    }, [values]);

    const J2 = React.useMemo(() => {
        const date: dayjs.Dayjs = values.date; if (!date) return undefined;
        const s = date.date(3).startOf('day');
        const e = date.date(9).startOf('day');
        return [s, e];
    }, [values]);

    const J3 = React.useMemo(() => {
        const date: dayjs.Dayjs = values.date; if (!date) return undefined;
        const s = date.date(10).startOf('day');
        const e = date.date(16).startOf('day');
        return [s, e];
    }, [values]);

    const J4 = React.useMemo(() => {
        const date: dayjs.Dayjs = values.date; if (!date) return undefined;
        const s = date.date(17).startOf('day');
        const e = date.date(23).startOf('day');
        return [s, e];
    }, [values]);

    const J5 = React.useMemo(() => {
        const date: dayjs.Dayjs = values.date; if (!date) return undefined;
        const s = date.date(24).startOf('day');
        const e = date.date(25).startOf('day');
        return [s, e];
    }, [values]);

    // 前端时间在选中的月份的第几阶段，如果超出返回 null
    const currentStage = React.useMemo(() => {
        const date: dayjs.Dayjs = values.date; if (!date) return null;
        const now = dayjs();
        if (now.isBefore(date.subtract(1, 'month').date(26).startOf('day'))) return null; // 还没到第一阶段
        if (now.isBetween(date.subtract(1, 'month').date(26).startOf('day'), date.date(2).startOf('day'), 'day', '[]')) return 1;
        if (now.isBetween(date.date(3).startOf('day'), date.date(9).endOf('day'), 'day', '[]')) return 2;
        if (now.isBetween(date.date(10).startOf('day'), date.date(16).endOf('day'), 'day', '[]')) return 3;
        if (now.isBetween(date.date(17).startOf('day'), date.date(23).endOf('day'), 'day', '[]')) return 4;
        if (now.isBetween(date.date(24).startOf('day'), date.date(25).endOf('day'), 'day', '[]')) return 5;
        return null; // 超出范围
    }, [values.date]);

    const columns1: TableColumnsType<any> = React.useMemo(() => [
        {
            title: '目标类型',
            align: 'center',
            dataIndex: 'targetType',
            key: 'targetType',
            render: e => <Text strong>{e}</Text>,
        },
        {
            title: '目标/元',
            dataIndex: 'target',
            key: 'target',
            align: 'center',
            render: e => toCurrencyNum(e, ''),
        },
        {
            title: '达成/元',
            dataIndex: 'achieved',
            key: 'achieved',
            align: 'center',
            render: e => toCurrencyNum(e, ''),
        },
        {
            title: '差额/元',
            dataIndex: 'difference',
            key: 'difference',
            align: 'center',
            render: e => toCurrencyNum(e, ''),
        },
        {
            title: '达成率',
            align: 'center',
            dataIndex: 'achievedRate',
            key: 'achievedRate',
            render: e => e === 'NaN%' ? '' : e,
        },
    ], []);

    const columns2: TableColumnsType<any> = React.useMemo(() => [
        {
            title: '目标类型',
            align: 'center',
            dataIndex: 'targetType',
            key: 'targetType',
            fixed: 'left',
            render: e => <Text strong>{e}</Text>,
        },
        {
            title: <><Text>{J1?.[0].format('MM.DD')}-{J1?.[1].format('MM.DD')}/25%</Text>{currentStage === 1 ? <Text type="danger">(当前阶段)</Text> : <></>}</>,
            className: styles['table-zz'],
            children: [
                {
                    title: '阶段目标/元',
                    dataIndex: 'stage1Target',
                    key: 'stage1Target',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '阶段达成/元',
                    dataIndex: 'stage1Achieved',
                    key: 'stage1Achieved',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '差额/元',
                    dataIndex: 'stage1Difference',
                    key: 'stage1Difference',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '达成率',
                    align: 'center',
                    dataIndex: 'stage1AchievedRate',
                    key: 'stage1AchievedRate',
                    className: styles['table-zz'],
                    render: e => e === 'NaN%' ? '' : e,
                }
            ]
        },
        {
            // title: `${J2?.[0].format('MM.DD')}-${J2?.[1].format('MM.DD')}/30%` + (currentStage === 2 ? '(当前阶段)' : ''),
            title: <><Text>{J2?.[0].format('MM.DD')}-{J2?.[1].format('MM.DD')}/25%</Text>{currentStage === 2 ? <Text type="danger">(当前阶段)</Text> : <></>}</>,
            children: [
                {
                    title: '阶段目标/元',
                    dataIndex: 'stage2Target',
                    key: 'stage2Target',
                    align: 'center',
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '阶段达成/元',
                    dataIndex: 'stage2Achieved',
                    key: 'stage2Achieved',
                    align: 'center',
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '差额/元',
                    dataIndex: 'stage2Difference',
                    key: 'stage2Difference',
                    align: 'center',
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '达成率',
                    align: 'center',
                    dataIndex: 'stage2AchievedRate',
                    key: 'stage2AchievedRate',
                    render: e => e === 'NaN%' ? '' : e,
                }
            ]
        },
        {
            // title: `${J3?.[0].format('MM.DD')}-${J3?.[1].format('MM.DD')}/25%` + (currentStage === 3 ? '(当前阶段)' : ''),
            title: <><Text>{J3?.[0].format('MM.DD')}-{J3?.[1].format('MM.DD')}/25%</Text>{currentStage === 3 ? <Text type="danger">(当前阶段)</Text> : <></>}</>,
            className: styles['table-zz'],
            children: [
                {
                    title: '阶段目标/元',
                    dataIndex: 'stage3Target',
                    key: 'stage3Target',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '阶段达成/元',
                    dataIndex: 'stage3Achieved',
                    key: 'stage3Achieved',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '差额/元',
                    dataIndex: 'stage3Difference',
                    key: 'stage3Difference',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '达成率',
                    align: 'center',
                    dataIndex: 'stage3AchievedRate',
                    key: 'stage3AchievedRate',
                    className: styles['table-zz'],
                    render: e => e === 'NaN%' ? '' : e,
                }
            ]
        },
        {
            // title: `${J4?.[0].format('MM.DD')}-${J4?.[1].format('MM.DD')}/20%` + (currentStage === 4 ? '(当前阶段)' : ''),
            title: <><Text>{J4?.[0].format('MM.DD')}-{J4?.[1].format('MM.DD')}/20%</Text>{currentStage === 4 ? <Text type="danger">(当前阶段)</Text> : <></>}</>,
            children: [
                {
                    title: '阶段目标/元',
                    dataIndex: 'stage4Target',
                    key: 'stage4Target',
                    align: 'center',
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '阶段达成/元',
                    dataIndex: 'stage4Achieved',
                    key: 'stage4Achieved',
                    align: 'center',
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '差额/元',
                    dataIndex: 'stage4Difference',
                    key: 'stage4Difference',
                    align: 'center',
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '达成率',
                    align: 'center',
                    dataIndex: 'stage4AchievedRate',
                    key: 'stage4AchievedRate',
                    render: e => e === 'NaN%' ? '' : e,
                }
            ]
        },
        {
            // title: `${J5?.[0].format('MM.DD')}-${J5?.[1].format('MM.DD')}/20%` + (currentStage === 5 ? '(当前阶段)' : ''),
            title: <><Text>{J5?.[0].format('MM.DD')}-{J5?.[1].format('MM.DD')}/20%</Text>{currentStage === 5 ? <Text type="danger">(当前阶段)</Text> : <></>}</>,
            className: styles['table-zz'],
            children: [
                {
                    title: '阶段目标/元',
                    dataIndex: 'stage5Target',
                    key: 'stage5Target',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '阶段达成/元',
                    dataIndex: 'stage5Achieved',
                    key: 'stage5Achieved',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '差额/元',
                    dataIndex: 'stage5Difference',
                    key: 'stage5Difference',
                    align: 'center',
                    className: styles['table-zz'],
                    render: e => toCurrencyNum(e, ''),
                }, {
                    title: '达成率',
                    align: 'center',
                    dataIndex: 'stage5AchievedRate',
                    key: 'stage5AchievedRate',
                    className: styles['table-zz'],
                    render: e => e === 'NaN%' ? '' : e,
                }
            ]
        },
    ], [J1, J2, J3, J4, J5, currentStage]);

    /** 目标 */
    const target = React.useCallback((fw = ['售卡', '划卡', '外卖']) => {
        const date: dayjs.Dayjs = values.date; if (!date) return 0;
        const target = data.target?.filter(e => {
            return MonthEnum[e['月份']] === date.month()
        })

        let sum = 0;
        fw.forEach(f => {
            sum += target?.reduce((acc, cur) => acc + (cur[f] || 0), 0) || 0;
        })

        return sum;
        // return target?.reduce((acc, cur) => acc + (cur['售卡'] || 0) + (cur['划卡'] || 0) + (cur['外卖'] || 0), 0) || 0;
    }, [data.target, values.date]);

    /** 达成 */
    const achieved = React.useCallback((start?: dayjs.Dayjs, end?: dayjs.Dayjs, fw?: string[]) => {
        if (!start || !end) return 0;
        let sum = 0;

        fw = fw || ['售卡', '划卡', '外卖']

        // 售卡
        if (fw.includes('售卡')) {
            data.equity
                ?.filter(e => {
                    const date = toXlsxDay(e['日期']);
                    return date.isBetween(start, end, 'day', '[]');
                })
                ?.forEach(e => {
                    if (e['权益金类型'] === '开卡金额' || e['权益金类型'] === '续卡金额') {
                        sum += e['权益金'] || 0;
                    }
                })
        }

        // 划卡
        if (fw.includes('划卡')) {
            const turnover = data.turnover
                ?.filter(e => {
                    const date = toXlsxDay(e['日期']);
                    return date.isBetween(start, end, 'day', '[]');
                })
            sum += countCardSwipe(turnover, data.project, data.cardType);
        }

        // 外卖
        if (fw.includes('外卖')) {
            data.equity
                ?.filter(e => {
                    const date = toXlsxDay(e['日期']);
                    return date.isBetween(start, end, 'day', '[]');
                })
                ?.forEach(e => {

                    if (e['权益金类型'] === '外卖') {
                        sum += e['权益金'] || 0;
                    }
                })
        }

        return sum;
    }, [data.cardType, data.equity, data.project, data.turnover]);

    const dataSource = React.useMemo(() => {
        return [
            {
                targetType: '合计',
                target: target(),
                achieved: achieved(J1?.[0], J5?.[1]),
                difference: target() - achieved(J1?.[0], J5?.[1]),
                achievedRate: ((achieved(J1?.[0], J5?.[1]) / target()) * 100).toFixed(2) + '%',
                stage1Target: target() * 0.25,
                stage1Achieved: achieved(J1?.[0], J1?.[1]),
                stage1Difference: target() * 0.25 - achieved(J1?.[0], J1?.[1]),
                stage1AchievedRate: ((achieved(J1?.[0], J1?.[1]) / (target() * 0.25)) * 100).toFixed(2) + '%',
                stage2Target: target() * 0.30,
                stage2Achieved: achieved(J2?.[0], J2?.[1]),
                stage2Difference: target() * 0.30 - achieved(J2?.[0], J2?.[1]),
                stage2AchievedRate: ((achieved(J2?.[0], J2?.[1]) / (target() * 0.30)) * 100).toFixed(2) + '%',
                stage3Target: target() * 0.25,
                stage3Achieved: achieved(J3?.[0], J3?.[1]),
                stage3Difference: target() * 0.25 - achieved(J3?.[0], J3?.[1]),
                stage3AchievedRate: ((achieved(J3?.[0], J3?.[1]) / (target() * 0.25)) * 100).toFixed(2) + '%',
                stage4Target: target() * 0.20,
                stage4Achieved: achieved(J4?.[0], J4?.[1]),
                stage4Difference: target() * 0.20 - achieved(J4?.[0], J4?.[1]),
                stage4AchievedRate: ((achieved(J4?.[0], J4?.[1]) / (target() * 0.20)) * 100).toFixed(2) + '%',
                stage5Target: target() * 0.20,
                stage5Achieved: achieved(J5?.[0], J5?.[1]),
                stage5Difference: target() * 0.20 - achieved(J5?.[0], J5?.[1]),
                stage5AchievedRate: ((achieved(J5?.[0], J5?.[1]) / (target() * 0.20)) * 100).toFixed(2) + '%',
            },
            {
                targetType: '售卡',
                target: target(['售卡']),
                achieved: achieved(J1?.[0], J5?.[1], ['售卡']),
                difference: target(['售卡']) - achieved(J1?.[0], J5?.[1], ['售卡']),
                achievedRate: ((achieved(J1?.[0], J5?.[1], ['售卡']) / target(['售卡'])) * 100).toFixed(2) + '%',
                stage1Target: target(['售卡']) * 0.25,
                stage1Achieved: achieved(J1?.[0], J1?.[1], ['售卡']),
                stage1Difference: target(['售卡']) * 0.25 - achieved(J1?.[0], J1?.[1], ['售卡']),
                stage1AchievedRate: ((achieved(J1?.[0], J1?.[1], ['售卡']) / (target(['售卡']) * 0.25)) * 100).toFixed(2) + '%',
                stage2Target: target(['售卡']) * 0.30,
                stage2Achieved: achieved(J2?.[0], J2?.[1], ['售卡']),
                stage2Difference: target(['售卡']) * 0.30 - achieved(J2?.[0], J2?.[1], ['售卡']),
                stage2AchievedRate: ((achieved(J2?.[0], J2?.[1], ['售卡']) / (target(['售卡']) * 0.30)) * 100).toFixed(2) + '%',
                stage3Target: target(['售卡']) * 0.25,
                stage3Achieved: achieved(J3?.[0], J3?.[1], ['售卡']),
                stage3Difference: target(['售卡']) * 0.25 - achieved(J3?.[0], J3?.[1], ['售卡']),
                stage3AchievedRate: ((achieved(J3?.[0], J3?.[1], ['售卡']) / (target(['售卡']) * 0.25)) * 100).toFixed(2) + '%',
                stage4Target: target(['售卡']) * 0.20,
                stage4Achieved: achieved(J4?.[0], J4?.[1], ['售卡']),
                stage4Difference: target(['售卡']) * 0.20 - achieved(J4?.[0], J4?.[1], ['售卡']),
                stage4AchievedRate: ((achieved(J4?.[0], J4?.[1], ['售卡']) / (target(['售卡']) * 0.20)) * 100).toFixed(2) + '%',
                stage5Target: target(['售卡']) * 0.20,
                stage5Achieved: achieved(J5?.[0], J5?.[1], ['售卡']),
                stage5Difference: target(['售卡']) * 0.20 - achieved(J5?.[0], J5?.[1], ['售卡']),
                stage5AchievedRate: ((achieved(J5?.[0], J5?.[1], ['售卡']) / (target(['售卡']) * 0.20)) * 100).toFixed(2) + '%',
            },
            {
                targetType: '划卡',
                target: target(['划卡']),
                achieved: achieved(J1?.[0], J5?.[1], ['划卡']),
                difference: target(['划卡']) - achieved(J1?.[0], J5?.[1], ['划卡']),
                achievedRate: ((achieved(J1?.[0], J5?.[1], ['划卡']) / target(['划卡'])) * 100).toFixed(2) + '%',
                stage1Target: target(['划卡']) * 0.25,
                stage1Achieved: achieved(J1?.[0], J1?.[1], ['划卡']),
                stage1Difference: target(['划卡']) * 0.25 - achieved(J1?.[0], J1?.[1], ['划卡']),
                stage1AchievedRate: ((achieved(J1?.[0], J1?.[1], ['划卡']) / (target(['划卡']) * 0.25)) * 100).toFixed(2) + '%',
                stage2Target: target(['划卡']) * 0.30,
                stage2Achieved: achieved(J2?.[0], J2?.[1], ['划卡']),
                stage2Difference: target(['划卡']) * 0.30 - achieved(J2?.[0], J2?.[1], ['划卡']),
                stage2AchievedRate: ((achieved(J2?.[0], J2?.[1], ['划卡']) / (target(['划卡']) * 0.30)) * 100).toFixed(2) + '%',
                stage3Target: target(['划卡']) * 0.25,
                stage3Achieved: achieved(J3?.[0], J3?.[1], ['划卡']),
                stage3Difference: target(['划卡']) * 0.25 - achieved(J3?.[0], J3?.[1], ['划卡']),
                stage3AchievedRate: ((achieved(J3?.[0], J3?.[1], ['划卡']) / (target(['划卡']) * 0.25)) * 100).toFixed(2) + '%',
                stage4Target: target(['划卡']) * 0.20,
                stage4Achieved: achieved(J4?.[0], J4?.[1], ['划卡']),
                stage4Difference: target(['划卡']) * 0.20 - achieved(J4?.[0], J4?.[1], ['划卡']),
                stage4AchievedRate: ((achieved(J4?.[0], J4?.[1], ['划卡']) / (target(['划卡']) * 0.20)) * 100).toFixed(2) + '%',
                stage5Target: target(['划卡']) * 0.20,
                stage5Achieved: achieved(J5?.[0], J5?.[1], ['划卡']),
                stage5Difference: target(['划卡']) * 0.20 - achieved(J5?.[0], J5?.[1], ['划卡']),
                stage5AchievedRate: ((achieved(J5?.[0], J5?.[1], ['划卡']) / (target(['划卡']) * 0.20)) * 100).toFixed(2) + '%',
            },
            {
                targetType: '外卖',
                target: target(['外卖']),
                achieved: achieved(J1?.[0], J5?.[1], ['外卖']),
                achievedRate: ((achieved(J1?.[0], J5?.[1], ['外卖']) / target(['外卖'])) * 100).toFixed(2) + '%',
                difference: target(['外卖']) - achieved(J1?.[0], J5?.[1], ['外卖']),
                stage1Target: target(['外卖']) * 0.25,
                stage1Achieved: achieved(J1?.[0], J1?.[1], ['外卖']),
                stage1Difference: target(['外卖']) * 0.25 - achieved(J1?.[0], J1?.[1], ['外卖']),
                stage1AchievedRate: ((achieved(J1?.[0], J1?.[1], ['外卖']) / (target(['外卖']) * 0.25)) * 100).toFixed(2) + '%',
                stage2Target: target(['外卖']) * 0.30,
                stage2Achieved: achieved(J2?.[0], J2?.[1], ['外卖']),
                stage2Difference: target(['外卖']) * 0.30 - achieved(J2?.[0], J2?.[1], ['外卖']),
                stage2AchievedRate: ((achieved(J2?.[0], J2?.[1], ['外卖']) / (target(['外卖']) * 0.30)) * 100).toFixed(2) + '%',
                stage3Target: target(['外卖']) * 0.25,
                stage3Achieved: achieved(J3?.[0], J3?.[1], ['外卖']),
                stage3Difference: target(['外卖']) * 0.25 - achieved(J3?.[0], J3?.[1], ['外卖']),
                stage3AchievedRate: ((achieved(J3?.[0], J3?.[1], ['外卖']) / (target(['外卖']) * 0.25)) * 100).toFixed(2) + '%',
                stage4Target: target(['外卖']) * 0.20,
                stage4Achieved: achieved(J4?.[0], J4?.[1], ['外卖']),
                stage4Difference: target(['外卖']) * 0.20 - achieved(J4?.[0], J4?.[1], ['外卖']),
                stage4AchievedRate: ((achieved(J4?.[0], J4?.[1], ['外卖']) / (target(['外卖']) * 0.20)) * 100).toFixed(2) + '%',
                stage5Target: target(['外卖']) * 0.20,
                stage5Achieved: achieved(J5?.[0], J5?.[1], ['外卖']),
                stage5Difference: target(['外卖']) * 0.20 - achieved(J5?.[0], J5?.[1], ['外卖']),
                stage5AchievedRate: ((achieved(J5?.[0], J5?.[1], ['外卖']) / (target(['外卖']) * 0.20)) * 100).toFixed(2) + '%',
            },
        ]
    }, [J1, J2, J3, J4, J5, achieved, target]);

    // 当前月份 - 大于25日算下个月
    const currentMonth = React.useMemo(() => {
        const date: dayjs.Dayjs = values.date;
        return date?.format?.('M');
    }, [values.date]);

    // 计算当前日期，在全阶段的100%目标中占比
    const currentDatePercentage = React.useMemo(() => {
        const date: dayjs.Dayjs = values.date;
        const now = dayjs();

        if (!date || !now) return 0;

        // 开始是上一个月 26 日，结束是本月的25日
        const start = date.subtract(1, 'month').date(26).startOf('day');
        const end = date.date(25).endOf('day');
        const totalDays = end.diff(start, 'day') + 1; // 包括开始和结束日期
        const currentDays = now.diff(start, 'day') + 1; // 包括开始日期
        return Math.min((currentDays / totalDays) * 100, 100); // 确保不超过100%
    }, [values.date]);

    React.useEffect(() => {
        form.setFieldsValue({
            date: dayjs(),
        });
        setValues({
            date: dayjs(),
        });
    }, [form]);

    return (
        <div style={{ padding: 20 }} >
            <Form form={form} layout='inline' onValuesChange={(_, e) => { setValues(e) }} >
                <Form.Item label="日期" name="date">
                    <DatePicker picker='month' />
                </Form.Item>
            </Form>

            <Divider />

            {values.date && <>
                <div style={{ display: 'flex', flexDirection: 'column', gap: 10 }} >
                    <Text strong style={{ display: 'block', textAlign: 'center', fontSize: 26 }} >成都仁和新城 {currentMonth} 月目标达成进度</Text>
                    <Progress percent={currentDatePercentage} strokeColor={{ '0%': '#108ee9', '100%': '#87d068' }} showInfo={false} />
                    <Table bordered dataSource={dataSource} columns={columns1} size='small' pagination={false} />
                    <Table bordered dataSource={dataSource} columns={columns2} size='small' pagination={false} scroll={{ x: 2000 }} />
                    
                    {/* <table className={styles['table']} >
                        <tbody>
                            <tr>
                                <td colSpan={2} style={{ width: 100, textAlign: 'center' }}><Text strong>目标类型</Text></td>
                                <td style={{ width: 'auto', textAlign: 'center' }}><Text strong>售卡</Text></td>
                                <td style={{ width: 'auto', textAlign: 'center' }}><Text strong>划卡</Text></td>
                                <td style={{ width: 'auto', textAlign: 'center' }}><Text strong>外卖</Text></td>
                                <td style={{ width: 'auto', textAlign: 'center' }}><Text strong>合计</Text></td>
                            </tr>
                            <tr>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['售卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['划卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['划卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                            </tr>
                            <tr>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['售卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['划卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['划卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                            </tr>
                            <tr>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['售卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['划卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['划卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                            </tr>
                            <tr>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['售卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['划卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['划卡']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                                <td style={{ textAlign: 'center' }}>{toCurrencyNum(target(['外卖']), '')}</td>
                            </tr>
                        </tbody>
                    </table> */}

                    <Text strong style={{ display: 'block', textAlign: 'center', fontSize: 26 }} >天天出单 步步为营 保级增收入 打爆{currentMonth}月</Text>
                </div>
            </>}
        </div>
    )
})
export default ProgressAchieved


function toXlsxDay(params: any) {
    return dayjs(XLSX.SSF.format("yyyy-mm-dd", params))
}